package wu.controller;

import org.apache.ibatis.session.SqlSession;
import wu.mapper.StudentMapper;
import wu.pojo.Student;
import wu.util.MyBatisUtils;

import java.util.List;

public class Student_Insert {
    private static final SqlSession sqlSession = MyBatisUtils.getSession();
    private static final StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
    public static void main(String[] args) {

        Student newStudent = new Student("软件231", "陈礼孝", "莱因赖因", 619768191);
        studentMapper.insertStudent(newStudent);
        System.out.println("插入成功 正在输出插入成功的表内容：");
        List<Student> students = studentMapper.getStudents();
        for (Student student : students) {
            System.out.println(student);
        }
        sqlSession.commit();
        sqlSession.close();
    }
}
